package com.smart.lab.view.adapter;


import android.content.Context;


import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.smart.lab.model.CropPestDiseaseEntity;
import com.smart.lab.view.fragment.DetailInfoFragment;

/**
 * Created by fjj on 2017/6/16.
 */

public class DetailPageAdapter extends FragmentPagerAdapter {

    private static int PAGE_COUNT;//表示要展示的页面数量
    private Context mContext;

    private CropPestDiseaseEntity cropPestDiseaseEntity;

    public DetailPageAdapter(Context context, FragmentManager fm, CropPestDiseaseEntity entity) {
        super(fm);
        this.mContext = context;
        PAGE_COUNT=4;
        this.cropPestDiseaseEntity=entity;

    }

    @Override
    public Fragment getItem(int position) {
        return DetailInfoFragment.newInstance(position,cropPestDiseaseEntity);
    }

    @Override
    public int getCount() {
        return PAGE_COUNT;
    }

    @Override
    public CharSequence getPageTitle(int position) {//设置标题
        switch (position) {
            case 0:
                return "分布地区";
            case 1:
                return "形态特征";
            case 2:
                return "生活习性";
            case 3:
                return "防治手段";
            default:break;

        }
        return null;
    }
}